package com.mammoth.Bodybuilding.entity;

import java.io.Serializable;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

/**
 * 
 * @title : SysMenu
 * @description : 系统菜单表
 * @company : com.mammoth.Bodybuilding.entity
 * @project Mammoth
 * @author xingzhaojun
 * @date 2018年4月26日 下午10:49:51
 */
@Entity
@Table(name = "SYS_MENU")
public class SysMenu implements Serializable {

	/**
	 * 序列号
	 */
	private static final long serialVersionUID = -2895615493888352403L;
	/** 主键id **/
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Long id;
	/** 菜单名称 **/
	private String menuName;
	/** 菜单地址 **/
	private String menuPath;
	/** 菜单图标 **/
	private String menuFa;
	/** 拥有权限 **/
	@ManyToMany(cascade = { CascadeType.REFRESH }, fetch = FetchType.EAGER)
	private List<SysRole> role;
	/** 排序号码 **/
	private int sortNum;
	/** 父id **/
	private Long fid;
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public String getMenuName() {
		return menuName;
	}
	public void setMenuName(String menuName) {
		this.menuName = menuName;
	}
	public String getMenuPath() {
		return menuPath;
	}
	public void setMenuPath(String menuPath) {
		this.menuPath = menuPath;
	}
	public String getMenuFa() {
		return menuFa;
	}
	public void setMenuFa(String menuFa) {
		this.menuFa = menuFa;
	}
	public List<SysRole> getRole() {
		return role;
	}
	public void setRole(List<SysRole> role) {
		this.role = role;
	}
	public int getSortNum() {
		return sortNum;
	}
	public void setSortNum(int sortNum) {
		this.sortNum = sortNum;
	}
	public Long getFid() {
		return fid;
	}
	public void setFid(Long fid) {
		this.fid = fid;
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((fid == null) ? 0 : fid.hashCode());
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		result = prime * result + ((menuFa == null) ? 0 : menuFa.hashCode());
		result = prime * result + ((menuName == null) ? 0 : menuName.hashCode());
		result = prime * result + ((menuPath == null) ? 0 : menuPath.hashCode());
		result = prime * result + ((role == null) ? 0 : role.hashCode());
		result = prime * result + sortNum;
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		SysMenu other = (SysMenu) obj;
		if (fid == null) {
			if (other.fid != null)
				return false;
		} else if (!fid.equals(other.fid))
			return false;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		if (menuFa == null) {
			if (other.menuFa != null)
				return false;
		} else if (!menuFa.equals(other.menuFa))
			return false;
		if (menuName == null) {
			if (other.menuName != null)
				return false;
		} else if (!menuName.equals(other.menuName))
			return false;
		if (menuPath == null) {
			if (other.menuPath != null)
				return false;
		} else if (!menuPath.equals(other.menuPath))
			return false;
		if (role == null) {
			if (other.role != null)
				return false;
		} else if (!role.equals(other.role))
			return false;
		if (sortNum != other.sortNum)
			return false;
		return true;
	}
	@Override
	public String toString() {
		return "SysMenu [id=" + id + ", menuName=" + menuName + ", menuPath=" + menuPath + ", menuFa=" + menuFa
				+ ", role=" + role + ", sortNum=" + sortNum + ", fid=" + fid + "]";
	}
	
	
	
}
